/**
* @description:  底部导航
* @author: JiWei
* @date:
**/
<template>
  <cover-view class="tabbar">
    <cover-view class="tabbar-item" v-for="(item, index) in list" :key="index" @click="tabbarChange(item.path,index)">
      <cover-image class="item-img" :src="item.icon_a" v-if="current == index"></cover-image>
      <cover-image class="item-img" :src="item.icon" v-else></cover-image>
      <cover-view class="item-name" :class="{'tabbarActive': current == index}" v-if="item.text">{{item.text}}
      </cover-view>
    </cover-view>
  </cover-view>
</template>
<script>
export default {
  name: 'tabBar',
  components: { },
  props: {
    current: {
      type: Number,
      default: function() {
        return 0
      }
    },
    list: {
      type: Array,
      default: function() {
        return []
      }
    }
  },
  data() {
    return {
      tabIndex: 0
    };
  },
  computed: {},
  watch: {},
  mounted() {},
  methods: {
    tabbarChange(path, index) {
      uni.reLaunch({
        url: path
      });
      this.tabIndex = index;
    }
  }
};
</script>
<style scoped lang="scss">
.tabbarActive {
  color: #01A0E9 !important;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  height: 50px;
  background-color: #ffffff;

  .tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 50px;
    position: relative;
    width: 60px;

    .tagNum {
      width: 26px;
      font-size: 12px;
      height: 14px;
      background: #f00;
      text-align: center;
      color: #fff;
      z-index: 1000;
      border-radius: 10px;
      position: absolute;
      top: 0px;
      left: 24px;
    }

    .item-img {
      margin-bottom: 2px;
      width: 22px;
      height: 22px;
    }

    .item-name {
      font-size: 12px;
      color: #A3A3A3;
    }
  }
}
</style>
